package net.ibizsys.eclipse.studio.xml;

import net.ibizsys.eclipse.studio.util.StringKit;

/**
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public class IBizDELogic extends IBizSearchableNode
{
	public static final String NODE_PSDELOGIC = "PSDELOGIC";

	/**
	 * 代码名称
	 */
	public static final String ATTR_CODENAME = "CODENAME";

	private String codeName;

	@Override
	protected void initAttribute(String name, String value)
	{
		if (StringKit.IsEqual(ATTR_CODENAME, name, true))
		{
			this.codeName = value;
			return;
		}

		super.initAttribute(name, value);
	}

	public String getCodeName()
	{
		return codeName;
	}

	@Override
	public String getText()
	{
		return String.format("[处理逻辑]%1$s", getName());
	}

	@Override
	public boolean match(String keyword)
	{
		if (super.match(keyword))
		{
			return true;
		}
		if (StringKit.has(getCodeName(), keyword) || StringKit.has(getText(), keyword) || StringKit.has(NODE_PSDELOGIC, keyword))
		{
			return true;
		}

		return false;
	}
}
